package com.ruoyi.training.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.training.mapper.TrainingReservationMapper;
import com.ruoyi.training.domain.TrainingReservation;
import com.ruoyi.training.service.ITrainingReservationService;

/**
 * 培训预约记录Service业务层处理
 * 
 * @author WorrilessGo
 * @date 2025-09-24
 */
@Service
public class TrainingReservationServiceImpl implements ITrainingReservationService 
{
    @Autowired
    private TrainingReservationMapper trainingReservationMapper;

    /**
     * 查询培训预约记录
     * 
     * @param trainingReservationId 培训预约记录主键
     * @return 培训预约记录
     */
    @Override
    public TrainingReservation selectTrainingReservationByTrainingReservationId(String trainingReservationId)
    {
        return trainingReservationMapper.selectTrainingReservationByTrainingReservationId(trainingReservationId);
    }

    /**
     * 查询培训预约记录列表
     * 
     * @param trainingReservation 培训预约记录
     * @return 培训预约记录
     */
    @Override
    public List<TrainingReservation> selectTrainingReservationList(TrainingReservation trainingReservation)
    {
        return trainingReservationMapper.selectTrainingReservationList(trainingReservation);
    }

    /**
     * 新增培训预约记录
     * 
     * @param trainingReservation 培训预约记录
     * @return 结果
     */
    @Override
    public int insertTrainingReservation(TrainingReservation trainingReservation)
    {
        trainingReservation.setCreateTime(DateUtils.getNowDate());
        return trainingReservationMapper.insertTrainingReservation(trainingReservation);
    }

    /**
     * 修改培训预约记录
     * 
     * @param trainingReservation 培训预约记录
     * @return 结果
     */
    @Override
    public int updateTrainingReservation(TrainingReservation trainingReservation)
    {
        trainingReservation.setUpdateTime(DateUtils.getNowDate());
        return trainingReservationMapper.updateTrainingReservation(trainingReservation);
    }

    /**
     * 批量删除培训预约记录
     * 
     * @param trainingReservationIds 需要删除的培训预约记录主键
     * @return 结果
     */
    @Override
    public int deleteTrainingReservationByTrainingReservationIds(String[] trainingReservationIds)
    {
        return trainingReservationMapper.deleteTrainingReservationByTrainingReservationIds(trainingReservationIds);
    }

    /**
     * 删除培训预约记录信息
     * 
     * @param trainingReservationId 培训预约记录主键
     * @return 结果
     */
    @Override
    public int deleteTrainingReservationByTrainingReservationId(String trainingReservationId)
    {
        return trainingReservationMapper.deleteTrainingReservationByTrainingReservationId(trainingReservationId);
    }
}
